<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 200px;
            height: 100px;
            border: 1px solid black;
            text-align: center;
            border-radius: 5px;
            box-shadow: 2px 2px 2px #ccc;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="box">
            <h3>自动售货机</h3>
            <button @click="pay(5)">可乐5元</button>
            <button @click="pay(10)">咖啡10元</button>    
        </div>
        <p>银行卡余额 {{money}}元</h1>
    </div>

    <script src="../lib/vue.js"></script>

    <script>
        const app = new Vue({
            el: "#app",
            data() {
                return {
                    money: 999
                }
            },
            methods: {
                pay(val) {
                    this.money = this.money - val
                }
            }

        })
    </script>
</body>

</html>